﻿function Submitlogin() {
    $('#error-message').html('');
    $('#frm-login').submit();
}

function ForgetPassword() {
    $('#ForgetPasswordButton').css("display", "none");
    $('#forget-password-penel').css("display", "block");
    $('#ResultMessage').html('');
    $('#ForgetUserName').focus();
}
function ForgetPasswordCancel() {
    $('#ForgetUserName').val('');
    $('#ResultMessage').html('');
    $('#ForgetPasswordButton').css("display", "block");
    $('#forget-password-penel').css("display", "none");
}

function ForgetPasswordSend() {
    var username = $('#ForgetUserName').val();
    if (username == '' || username == null || username.toLowerCase() == 'admin')
        return false;        
    var action = '/Login/ForgetPassword?userName=' + username;
    $.ajax({
        type: 'POST',
        url: action,
        data: '',
        success: function (data, textStatus, XMLHttpRequest) {                        
            if (data.Result == true) {
                $('#ForgetUserName').val('');
                $('#forget-password-penel').css("display", "none");
                $('#ForgetPasswordButton').css("display", "block");
                $('#UserName').focus();
                $('#ResultMessage').html('&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;' + data.Message);
            }
            else {
                $('#ForgetUserName').focus();
                $('#ResultMessage').html(data.Message);
            }

        }
    });

}